<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>函数</title>
</head>
<body>
    <script>
        //无参无返回值的方法
        function println(){
            document.write("fuck you"+"<br>");
        }
        //调用方法
        println();


        //有参有返回值的方法
        function getNumber(num1,num2){
            return num1+num2;
        }
        //调用方法
        let result=getNumber(1,2);
        document.write(result+"<br>");



        //可变参数 
        function getSum(...numbers){
            let sum=0;
                for (let i = 0; i < numbers.length; i++) {
                sum+=numbers[i];
            }
            return sum;
        }
        //调用方法
        let result1=getSum(1,2,3,4);
        document.write(result1+"<br>");


        //匿名内部类
        let name =function(){
            document.write("zx");
        }
        name();
        
    </script>
</body>
</html>